Conversation
Add factory functions that provide a simpler API for constructing query objects to use with search_documents(): - text_query(field, query, boost=None, slop=None) - Creates a TextQuery - vector_query(field, values=None, sparse_values=None) - Creates a VectorQuery Both functions are exported from the pinecone package for convenient imports. Linear: SDK-109
…actory-functions-text_query-vector_query
…arch API Add response model classes for the document search API: - Document class with id, score, and dynamic field access via attribute, dict-style, and safe get() methods - DocumentSearchResponse class wrapping documents list with usage info - Unit tests for all access patterns and edge cases - Export classes via lazy imports in pinecone module Closes SDK-110
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR adds response model classes for the document search API, enabling a clean and intuitive interface for working with search results.
id,score, and dynamic field accessProblem
The document search API needs response models that allow users to easily access search results. Documents can have dynamic fields (varying per index schema), so the
Documentclass needs to support flexible field access patterns.Solution
The
Documentclass provides three ways to access fields:The class also supports:
idandscorepropertieskeys(),values(),items()for iterationinoperator for field existence checksto_dict()for serializationUsage Example
Test Plan
doc["field"])Related
Note
Low Risk
Low risk: this is additive (new dataclasses + exports) with unit tests; primary impact is new public API surface and lazy-import wiring.
Overview
Adds document-search response models. Introduces
Document(supportsid/scoreplus dynamic fields via attribute access,[], andget()) andDocumentSearchResponse(wrapsdocuments, optionalusage, and_response_info).Exposes these types through
pinecone.db_data.dataclassesand top-levelpineconelazy imports, and adds unit tests covering field access patterns, dict-like behavior, equality/serialization, and basic response usage.Written by Cursor Bugbot for commit 64ab854. This will update automatically on new commits. Configure here.